package com.kmust.dream.wanderingdream.donation.service.impl;

import com.kmust.dream.wanderingdream.comm.utils.PageUtils;
import com.kmust.dream.wanderingdream.comm.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.kmust.dream.wanderingdream.donation.dao.LearningstatusInformationDonationDao;
import com.kmust.dream.wanderingdream.donation.entity.LearningstatusInformationDonationEntity;
import com.kmust.dream.wanderingdream.donation.service.LearningstatusInformationDonationService;


@Service("learningstatusInformationDonationService")
public class LearningstatusInformationDonationServiceImpl extends ServiceImpl<LearningstatusInformationDonationDao, LearningstatusInformationDonationEntity> implements LearningstatusInformationDonationService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<LearningstatusInformationDonationEntity> page = this.page(
                new Query<LearningstatusInformationDonationEntity>().getPage(params),
                new QueryWrapper<LearningstatusInformationDonationEntity>()
        );
        page.setSize(3);//设置每页记录数
        long pages = page.getRecords().size();//得到总记录数
        page.setPages(pages);//设置一共分了几页(传入后自动计算)
        page.setTotal(pages);//设置总记录数

        return new PageUtils(page);
    }
    @Autowired
    LearningstatusInformationDonationDao learningstatusDao;
    @Override
    public List<LearningstatusInformationDonationEntity> getResultsList(String recipientId) {
        List<LearningstatusInformationDonationEntity> list =learningstatusDao.getList(recipientId);

        return list;
    }

    @Override
    public List<LearningstatusInformationDonationEntity> getAllList() {
        List<LearningstatusInformationDonationEntity> list =learningstatusDao.getAllList();
        return list;
    }


}